//
//  OrigPubSelectBtnCollectionCell.m
//  ShrimpCrowdordering
//
//  Created by jimmy on 2018/8/25.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "OrigPubSelectBtnCollectionCell.h"

@interface OrigPubSelectBtnCollectionCell ()

@property (nonatomic, strong) UIButton * selectBtn;

@end

@implementation OrigPubSelectBtnCollectionCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setViewUIFrame:frame];
    }
    return self;
}

- (void)setViewUIFrame:(CGRect)frame
{
    self.selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.selectBtn.frame = CGRectMake(ScreenX375(10), (frame.size.height - ScreenX375(26))/2, frame.size.width - ScreenX375(10), ScreenX375(26));
    self.selectBtn.layer.cornerRadius = 13;
    self.selectBtn.layer.masksToBounds = YES;
    self.selectBtn.userInteractionEnabled = NO;
    self.selectBtn.titleLabel.font = Kfont(15);
    [self addSubview:self.selectBtn];
    
}

- (void)setUIWithTitle:(NSString *)title
{
    [self.selectBtn setTitle:title forState:UIControlStateNormal];
}

- (void)isSelect:(BOOL)isSelected
{
    if (isSelected) {
        self.selectBtn.backgroundColor = [UIColor colorWithHexString:@"#fd5656"];
        [self.selectBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.selectBtn.layer.borderColor = [[UIColor colorWithHexString:@"#fd5656"] CGColor];
    }else{
        self.selectBtn.layer.borderColor = [[UIColor colorWithHexString:@"#eaeaea"] CGColor];
        self.selectBtn.layer.borderWidth = 1;
        self.selectBtn.backgroundColor = [UIColor whiteColor];
        [self.selectBtn setTitleColor:[UIColor colorWithHexString:@"#212121"] forState:UIControlStateNormal];
    }
}
@end
